package com.github.xuchen93.forlaozeng.opreate_1;

import java.util.Arrays;

/**
 * @author xuchen.wang
 */
public class Subject_2 {

	public static void main(String[] args) {
		sortDesc(new int[]{5,9,4,3,7});
		sortDesc(new int[]{5,2,4,3,7});
		sortDesc(new int[]{1,5,9,7,3});
		sortDesc(new int[]{1,2,3,4,5});
		sortDesc(new int[]{5,4,3,2,1});
	}

	public static void sortDesc(int[] arr){
		//快速排序法
		for (int i = 0; i < arr.length-1; i++) {
			int index = i;
			for (int j = i; j <arr.length; j++) {
				if (arr[index]<arr[j]){
					index = j;
				}
			}
			int temp = arr[i];
			arr[i] = arr[index];
			arr[index] = temp;
		}
		System.out.println(Arrays.toString(arr));
	}
}
